<template>
  <div>
    <el-table :data="getSeckList" border style="width: 100%">
      <el-table-column prop="title" label="活动名称" width="180"> </el-table-column>
      <el-table-column prop="status" label="状态" width="180">
        <template slot-scope="item">
          <div>
            {{ item.row.status == 1 ? "启用" : "禁用" }}
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="address" label="操作">
        <template slot-scope="item">
          <div>
            <el-button type="primary" size="mini" plain @click="edit(item.row.id)"
              >编辑</el-button
            >
            <el-button type="danger" size="mini" plain @click="del(item.row.id)"
              >删除</el-button
            >
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import { mapActions, mapGetters } from "vuex";
import {seckDelete} from '../../request/api.js'
export default {
  data() {
    return {

    };
  },
  methods: {
    ...mapActions({
      getSeckListActions: "seck/getSeckListActions",
    }),
    // 编辑
    edit(id) {
      this.$emit('edit', id);
    },
    // 删除
    del(id) {
      this.$confirm("你确定要离开我么", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        //点击确定删除后请求删除接口
        .then(async () => {
          let res = await seckDelete({ id });
          if (res.code == 200) {
            // 成功 提示
            this.$message.success(res.msg);
            // 请求数据
            // this.action_seckList();
            this.getSeckListActions()
          } else {
            // 失败 提示
            this.$message.error(res.msg);
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
  },
  mounted() {
    this.getSeckListActions();
  },
  watch: {},
  computed: {
    ...mapGetters({
      getSeckList: "seck/getSeckList",
    }),
  },
  filters: {},
  components: {},
};
</script>
<style scoped></style>
